<!--#layout("/common/layout.html",{"jsBase":"/js/cms/employeeManage/"}){ -->

<form class="layui-form " id="addForm">
	<div class="layui-row">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label"><span style="color: red;font-size: 18px;">*</span>&nbsp;&nbsp;选择开户企业</label>
				<div class="layui-input-inline">
					<select  lay-verify="required" name="organizationCode" id="organizationCode" lay-search lay-filter="declareYear">
						<option value="">请选择</option>
						<!--#
                         for(item in org){
                         -->
						<option id="organizationCode${item.organizationCode}"  enterpriseDirectory="${item.enterpriseDirectory}"
								directoryEnterprises="${item.directoryEnterprises}" businessQuota="${item.businessQuota}" value="${item.organizationCode}">${item.enterpriseName}</option>
						<!--# }-->
					</select>
				</div>
			</div>
			<!--<div class="layui-inline">
				<label class="layui-form-label">联系人</label>
				<div class="layui-input-inline">
					<input type="text" name="enterpriseLegalPerson"
						   placeholder="请输入"  class="layui-input">
				</div>
			</div>-->
		</div>
	</div>

	<div class="layui-row">
		<div class="layui-form-item">
			<div class="layui-inline">
			<label class="layui-form-label">企业登录账户</label>
			<div class="layui-input-inline">
				<input type="" id="code" name="code" readonly
					    autocomplete="off" class="layui-input input-readonly"
					   value="">
			</div>
			</div>
			<div class="layui-inline">
				<label class="layui-form-label">组织中文名称</label>
				<div class="layui-input-inline">
					<input type="text" id="name" name="name"  lay-verify="required"
						   placeholder="" class="layui-input input-readonly" value="" readonly>
				</div>
			</div>
		</div>
	</div>

	<div class="layui-row">
		<div class="layui-form-item">
			<div class="layui-inline">
				<label class="layui-form-label">密码</label>
				<div class="layui-input-inline">
					<input type="text" id="passWord" name="passWord"  lay-verify="required"
						    value="${passWord}" class="layui-input" readonly>
				</div>
			</div>
		</div>
	</div>


	<input type="hidden" id="enterpriseDirectory" name="enterpriseDirectory"   >
	<input type="hidden" id="directoryEnterprises" name="directoryEnterprises"   >
	<input type="hidden" id="businessQuota" name="businessQuota">
	<layui:submitButtons id="saveUser" />
</form>
<!--#} -->
<script>
    layui.use(['examineAdd'], function(){
        var userAdd = layui.examineAdd
        userAdd.init();


        var form = layui.form;
        form.on('select(declareYear)', function (data) {
            if($("#organizationCode option:selected").text()!="请选择"){
                var num=data.value;
                $("#enterpriseDirectory").val($("#organizationCode"+num).attr("enterpriseDirectory"));
                $("#directoryEnterprises").val($("#organizationCode"+num).attr("directoryEnterprises"));
                $("#businessQuota").val($("#organizationCode"+num).attr("businessQuota"));
                /**
                 * 登录账号格式  取【社会信用代码】的第7位至倒数第二位
                 */
                var organizationCode = $("#organizationCode").val();
                var length = organizationCode.length;
                var actualNeed = organizationCode.substr(6, length - 1 - 6);
                $("input[name='code']").val(actualNeed);
                $("#name").val(data.elem[data.elem.selectedIndex].text);
            }else {
                $("input[name='code']").val("");
                $("#name").val("");
            }
        });
    });

</script>

